package com.ak.controller;


import com.ak.service.MySocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

@Controller
public class SocketController {

    @Autowired
    MySocket websocket;

    @ResponseBody
    @RequestMapping("/sendAll")
    public String sendAll(@RequestParam("msg") String msg) throws IOException {
          //其实没用上
        String fromUserId="system";
        websocket.sendMessageAll(msg,fromUserId);

        return "推送成功";
    }


    @RequestMapping("/index")
    public String index(){
        return "index";
    }
}
